home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
Z4PFBLD.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-02
|
4KB
|
144 lines
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: z4pfbld.c
// Title: 9-Digit ZIP Code Directory -- on CD-ROM
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
// This module contains the program entry point for
//
// The code in this module may be written in C++ or C.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// OS/2 2.X+
// OS/2 2.0 PM
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS
// Borland C++ 1.0 for OS/2 2.X
//
//----------------------------------------------------------------------------
#include <z4.h>
//----------------------------------------------------------------------------
// Stack size
//----------------------------------------------------------------------------
#if COMPILER_BORLAND && (OS_DOS || OS_WINDOWS)
unsigned _stklen = 0x4000;
#endif
//----------------------------------------------------------------------------
// Globals
//----------------------------------------------------------------------------
//
// A useless string which is simply embedded in the executable.
//
PSZ __pszCredits__ = "Written by John M Weeder, 1993";
//
// This should contain a program description which will be displayed as
// part of the program's help text.
//
static PCSZ pcszDescription =
"This program builds the POF database. This database is only used\n"
"during the file build process.";
//
// Program command line options
//
static DATACFG dcfg;
static BOOL fSort = FALSE;
static BOOL fCompress = FALSE;
static BOOL fIndex = FALSE;
static BOOL fCheck = FALSE;
static CHAR szConfig[MAX_PATH] = "z4pf";
static BS_CMDOPT acmdopt[] =
{
{ "CHECK", (PVOID)&fCheck, CMDOPT_TRUE, "Validate CRC codes."},
{ "COMPRESS", (PVOID)&fCompress, CMDOPT_TRUE, "Compress data file."},
{ "INDEX", (PVOID)&fIndex, CMDOPT_TRUE, "Index data file."},
{ "SORT", (PVOID)&fSort, CMDOPT_TRUE, "Sort stripped data file."},
{ "config", (PVOID)szConfig, CMDOPT_FILESPEC(80), "Configuration file name."},
BS_CMDOPT_NULL,
};
//----------------------------------------------------------------------------
// Description: main() - Program entry point
// Parameters: Standard C parameters
// Returns: DOS return code.
//----------------------------------------------------------------------------
int main(int argc, char **argv)
{
static BS_CFG cfg = CFG_DFT;
int retval = 99;
//
// Initialize base library
//
BaseLibraryInitialize(argc, argv, &cfg);
BaseTitle("$Revision: 93.1 $", __DATE__, __TIME__, "ZIP+4 POF File Build");
if (!BaseTitleHelp(acmdopt, pcszDescription,NULL))
return 99;
DioSetDataPath(getenv("DATA"));
if (!DataConfigRead(szConfig, &dcfg))
{
Output("Failed reading configuration file.\n");
goto ERROR_EXIT;
}
if (fSort)
if (!DataSort(&dcfg))
{
Output("Failed sorting delimited data file.\n");
goto ERROR_EXIT;
}
if (fCompress)
if (!DataCompress(&dcfg, Z4PFCompress, 0))
{
Output("Failed compressing delimited data file.\n");
goto ERROR_EXIT;
}
if (fIndex)
if (!DataIndex(&dcfg, Z4PFIndex))
{
Output("Failed indexing CS data file.\n");
return 99;
}
if (fCheck)
if (!DioCheck(dcfg.szData))
{
Output("Failed verifying data file.\n");
return 99;
}
retval = 0;
ERROR_EXIT:
DioCloseAll();
return retval;
}
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------